<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="../../js/vue.js"></script>
</head>
<body>
  <div id="root">
    <button @click="addSex">点击怎加性别</button>
    <ul>
      <li>姓名:{{person.name}}</li>
      <li>年龄:{{person.age}}</li>
      <li v-show="person.sex">性别:{{person.sex}}</li>
    </ul>
  </div>

  <script type="text/javascript">
    var vm = new Vue({
      el:'#root',
      data:{
        person:{name:'张三','age':20}
      },
      methods:{
        addSex(){
          //Vue.set(this.person,'sex','男');
          vm.$set(this.person,'sex','女')
        }
      }
    });
  </script>
</body>
</html>
